package top.purity.server.user.domain;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Comment;
import top.purity.framework.orm.BaseTenantDO;
import org.hibernate.annotations.ColumnDefault;

/**
 * @Author lmh
 * @Description
 * @CreateTime 2023-09-25 15:23
 */

@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "user_role", uniqueConstraints = {
        @UniqueConstraint(columnNames = {"role_code", "tenant_id"})
}, indexes = {
        @Index(name = "idx_rc", columnList = "role_code", unique = true),
        @Index(name = "idx_rn", columnList = "role_name")
})
public class Role extends BaseTenantDO {

    @Column(name = "role_name", nullable = false, length = 50)
    @Comment("角色名称")
    private String roleName;

    @Column(name = "role_code", nullable = false, length = 100)
    @Comment("角色编号")
    private String roleCode;

    @Column(name = "status")
    @ColumnDefault("true")
    @Comment("角色状态")
    private Boolean status;

}
